package com.xdtech.parking.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.parking.model.ParkingDevice;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-06-18 14:30:33
 * @since 1.0
 * @see
 */
public class ParkingDeviceItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="设备唯一识别码",width=100)
	private String ukey;
	@GridColumn(title="区域代码",width=100)
	private String areaCode;
	@GridColumn(title="网关代码",width=100)
	private String gwid;
	@GridColumn(title="设备代码",width=100)
	private String deviceCode;
	@GridColumn(title="状态标记",width=100,dictionaryCode="PARK_DEVICE_STATUS")
	private Integer status;
//	@GridColumn(title="设置（升/降）",width=100,dictionaryCode="PARK_CAR_SET")
	private String setVal;
//	@GridColumn(title="错误码",width=100)
	private String error;
	@GridColumn(title="Tag标记",width=100)
	private String tag;
	@GridColumn(title="电量指数",width=100)
	private Integer kwh;
	@GridColumn(title="停车位是否有车",width=100,dictionaryCode="PARK_HASCAR_TYPE")
	private Integer hasCar;
	@GridColumn(title="计费方式",width=100,dictionaryCode="DEVICE_BILLING")
	private String billing;
	@GridColumn(title="单位费用(分)",width=100)
	private Integer cost;

	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public String getUkey() {
		return ukey;
	}
	public void setUkey(String ukey) {
		this.ukey = ukey;
	}
	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
		addQuerys("areaCode", areaCode);
	}
	public String getAreaCode() {
		return areaCode;
	}
	
	public void setGwid(String gwid) {
		this.gwid = gwid;
		addQuerys("gwid", gwid);
	}
	public String getGwid() {
		return gwid;
	}
	
	public void setDeviceCode(String deviceCode) {
		this.deviceCode = deviceCode;
		addQuerys("deviceCode", deviceCode);
	}
	public String getDeviceCode() {
		return deviceCode;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
		addQuerys("status", status);
	}
	
	public String getBilling() {
		return billing;
	}
	public void setBilling(String billing) {
		this.billing = billing;
		addQuerys("billing", billing);
	}
	public Integer getCost() {
		return cost;
	}
	public void setCost(Integer cost) {
		this.cost = cost;
		addQuerys("cost", cost);
	}
	public String getSetVal() {
		return setVal;
	}
	public void setSetVal(String setVal) {
		this.setVal = setVal;
	}
	public Integer getHasCar() {
		return hasCar;
	}
	public void setHasCar(Integer hasCar) {
		this.hasCar = hasCar;
	}
	public void setError(String error) {
		this.error = error;
		addQuerys("error", error);
	}
	public String getError() {
		return error;
	}
	
	public void setTag(String tag) {
		this.tag = tag;
		addQuerys("tag", tag);
	}
	public String getTag() {
		return tag;
	}
	
	public void setKwh(Integer kwh) {
		this.kwh = kwh;
		addQuerys("kwh", kwh);
	}
	public Integer getKwh() {
		return kwh;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static ParkingDeviceItem createItem(ParkingDevice parkingDevice) {
		ParkingDeviceItem parkingDeviceItem = new ParkingDeviceItem();
		BeanUtils.copyProperties(parkingDeviceItem, parkingDevice);
		//自定义属性设置填充
		return parkingDeviceItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<ParkingDeviceItem> createItems(List<ParkingDevice> parkingDevices) {
		List<ParkingDeviceItem> parkingDeviceItems = new ArrayList<ParkingDeviceItem>();
		for (ParkingDevice parkingDevice : parkingDevices) {
			parkingDeviceItems.add(createItem(parkingDevice));
		}
		return parkingDeviceItems;
	}
}
